# coding=utf-8
import sqlite3

conn = sqlite3.connect("test.db")  #打开或创建数据库文件


print("Open database successfully!")

c = conn.cursor()     #获取游标

sql = "select id,name,address,salary from company"

cursor = c.execute(sql)   #执行sql语句

for row in cursor:
    print("id = ",row[0])
    print("name = ",row[1])
    print("address = ",row[2])
    print("salary = ",row[3],"\n")


conn.close()     #关闭数据库连接

print('query data successfully!')